require 'rake'
require_relative 'assets_tasks'

namespace :jquery do
  JQUERY_URL = "http://code.jquery.com/jquery-latest.min.js"

  desc "Install latest JQuery in assets/ directory"
  task :install => [:create_assets, :download]

  task :create_assets do
    Rake::Task["assets:create"].invoke
  end
  task :download do
    sh "wget #{JQUERY_URL} -O assets/jquery.js -q"
  end
  desc "Remove JQuery from assets/ directroy"
  task :remove do
    if File.exist? "assets/jquery.js"
      rm_rf "assets/jquery.js"
      Rake::Task["assets:clean"].invoke
    else
      abort "It seems that JQuery is not installed"
    end
  end
end
